/*
 * Error.java
 *
 * Created on 28 March 2007, 20:17
 *
 */

package rxtokenizer;

/**
 * This class consist all errors and results of operation processing.
 * @author Ruslan Fayzrakhmanov
 */
public class Result {
    
    private Result(int id, String name, String description, String source) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.source = source;
    }
    
    final public int id;
    final public String name;
    final public String description;
	/**
	 * Probable sources of this result, error.
	 */
    final public String source;
    
    
    public static Result NO_ERROR = new Result(0, "No error", "All Right.", "");
    
    public static Result ERROR_01 = new Result(1, "Error 01", "Concept type with this name already has been created.", "ConceptTypeBuilder.addConceptType, ConceptTypeBuilder.changeConceptType");
    public static Result ERROR_02 = new Result(2, "Error 02", "Concept type is unknown.", "ConceptTypeBuilder.addConceptType, ConceptTypeBuilder.changeConceptType, ConceptExtractor.extract");
    public static Result ERROR_03 = new Result(3, "Error 03", "Concept type is used and can't be deleted.", "ConceptType.free");
    public static Result ERROR_04 = new Result(4, "Error 04", "Incorrect concept type name.", "ConceptTypeBuilder.addConceptType, ConceptTypeBuilder.changeConceptType");
    public static Result ERROR_05 = new Result(5, "Error 05", "Concept type with this name doesn't exist.", "ConceptTypeBuilder.deleteConceptType, ConceptExtractor.extract");
    
    public static Result ERROR_11 = new Result(11, "Error 11", "Incorrect attribute value.", "ExtractiveConcept.checkAttribute, ExtractiveConcept.setAttribute");
    public static Result ERROR_12 = new Result(12, "Error 12", "Unknown attribute name.", "ExtractiveConcept.checkAttribute, ExtractiveConcept.setAttribute");
    public static Result ERROR_13 = new Result(13, "Error 13", "Incorrect symbol in concept name", "ConceptType.checkConstraintExp, ConceptType.changeNameInConstraintExp, ConceptType.fullCheckConstraintExp, ConceptType.parseConstraintsExp, RegExpConceptType.changeNameInExtrExp, RegExpConceptType.checkExtractingExp, RegExpConceptType.parseFullCheck, RegExpConceptType.parseApply");
    public static Result ERROR_14 = new Result(14, "Error 14", "Incorrect symbol in attribute name", "ConceptType.checkConstraintExp, ConceptType.changeNameInConstraintExp, ConceptType.fullCheckConstraintExp, ConceptType.parseConstraintsExp, RegExpConceptType.changeNameInExtrExp, RegExpConceptType.checkExtractingExp, RegExpConceptType.parseFullCheck, RegExpConceptType.parseApply");
    public static Result ERROR_15 = new Result(15, "Error 15", "Incorrect attribute declaration. Symbol \" was expected.", "ConceptType.checkConstraintExp, ConceptType.changeNameInConstraintExp, ConceptType.fullCheckConstraintExp, ConceptType.parseConstraintsExp, RegExpConceptType.changeNameInExtrExp, RegExpConceptType.checkExtractingExp, RegExpConceptType.parseFullCheck, RegExpConceptType.parseApply");
    public static Result ERROR_16 = new Result(16, "Error 16", "Unexpected end of the extracting expression.", "ConceptType.checkConstraintExp, ConceptType.changeNameInConstraintExp, ConceptType.fullCheckConstraintExp, ConceptType.parseConstraintsExp, RegExpConceptType.changeNameInExtrExp, RegExpConceptType.checkExtractingExp, RegExpConceptType.parseFullCheck, RegExpConceptType.parseApply");
    public static Result ERROR_17 = new Result(17, "Error 17", "Concept name in extracting expression does not exist.", "RegExpConceptType.parseFullCheck, RegExpConceptType.parseApply");
    public static Result ERROR_18 = new Result(18, "Error 18", "Concept in extracting expression must be instance of RegExpConceptType.", "RegExpConceptType.parseFullCheck, RegExpConceptType.parseApply");
    public static Result ERROR_19 = new Result(19, "Error 19", "Used concept type isn't parsed.", "RegExpConceptType.parseFullCheck, RegExpConceptType.parseApply");
    public static Result ERROR_20 = new Result(20, "Error 20", "Recursive dependence is detected.", "RegExpConceptType.fullCheckExtractingExpRecursively, RegExpConceptType.parseExtractingExp, RegExpConceptType.parseMeAndAllDerivedConceptTypes");
    public static Result ERROR_21 = new Result(21, "Error 21", "Incorrect first symbol in constraint expression", "ConceptType.checkConstraintExp, ConceptType.changeNameInConstraintExp, ConceptType.fullCheckConstraintExp, ConceptType.parseConstraintsExp");
    public static Result ERROR_22 = new Result(22, "Error 22", "Unexpected continue of the constraint expression", "ConceptType.checkConstraintExp, ConceptType.changeNameInConstraintExp, ConceptType.fullCheckConstraintExp, ConceptType.parseConstraintsExp");
    public static Result ERROR_23 = new Result(23, "Error 23", "Incorrect symbol in extracting expression.", "RegExpConceptType.checkExtractingExp, RegExpConceptType.parseFullCheck, RegExpConceptType.parseApply");
    public static Result ERROR_24 = new Result(24, "Error 24", "Incorrect concept name in constraint expression.", "ConceptType.fullCheckConstraintExp, ConceptType.parseConstraintsExp");
    public static Result ERROR_25 = new Result(25, "Error 25", "Extracting expression has zero-length.", "RegExpConceptType.checkExtractingExp, RegExpConceptType.fullCheckExtractingExpRecursively, RegExpConceptType.parseApply");
    public static Result ERROR_26 = new Result(26, "Error 26", "Constraint expression has zero-length.", "RegExpConceptType.changeConstraintExp, RegExpConceptType.fullCheckConstraintExp, RegExpConceptType.parseConstraintsExp");
    
    public String toString() {
        return name+". "+description+"\nSources: "+source;
    }
    
}
